﻿@model OrderModel

@{
    Layout = "~/Administration/Views/Shared/_AdminPopupLayout.cshtml";

    //page title
    ViewBag.Title = T("Admin.Orders.Fields.PartialRefund").Text;
}

@if (ViewBag.RefreshPage == true)
{
    <script type="text/javascript">
        try {window.opener.document.forms['@(ViewBag.formId)'].@(ViewBag.btnId).click();}
        catch (e){}
        window.close();
    </script>
}

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    <div class="content-header clearfix">
        <h1 class="pull-left">
            @T("Admin.Orders.Fields.PartialRefund")
        </h1>
        <div class="pull-right">
            &nbsp;
        </div>
    </div>

    <div class="content">
        @Html.ValidationSummary(false)
        <div class="form-horizontal">
            <div class="panel-group">
                <div class="panel panel-default panel-popup">
                    <div class="panel-heading">
                        @string.Format(T("Admin.Orders.Fields.PartialRefund.OrderInfo").Text, Model.Id)
                    </div>
                    <div class="panel-body">
                        <div class="form-group">
                            <div class="col-sm-5">
                                @Html.NopLabelFor(model => model.AmountToRefund)
                            </div>
                            <div class="col-sm-7">
                                @Html.NopEditorFor(model => model.AmountToRefund)
                                <span style="white-space: nowrap">
                                    @string.Format(T("Admin.Orders.Fields.PartialRefund.AmountToRefund.Max").Text, Model.MaxAmountToRefund.ToString("G29"), Model.PrimaryStoreCurrencyCode)
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-7 col-sm-offset-5">
                                <button type="submit" name="partialrefundorder" id="partialrefundorder" class="btn btn-primary">
                                    @T("Admin.Orders.Fields.Refund")
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
}
